﻿using System.Threading;
using Mlog.Test;
using UnityEngine;
using ILogger = MLog.ILogger;

namespace MLog.Sample {
    public class DemoList : MonoBehaviour {
        private static readonly ILogger Log = MLog.GetLogger("Demo2");

        private void Start() {
            Log.Debug("DemoList: this is debug msg. params:{0} {1}", 1, "test");
            Log.Info("DemoList: this is info msg. params:{0} {1}", 1, "test");
            Log.Error("DemoList: this is error msg. params:{0} {1}", 1, "test");
            Log.Warning("DemoList: this is warning msg. params:{0} {1}", 1, "test");
            Demo1.TestLog();
            Demo2.TestLog();
            new Thread(Demo3.TestLog) {
                Name = "thread3"
            }.Start();
        }
    }

    public class Demo1 {
        private static readonly ILogger Log = MLog.GetLogger(typeof(Demo1));

        public static void TestLog() {
            Log.Debug("Demo1: this is debug msg. params:{0} {1}", 1, "test");
            Log.Info("Demo1: this is info msg. params:{0} {1}", 1, "test");
            Log.Error("Demo1: this is error msg. params:{0} {1}", 1, "test");
            Log.Warning("Demo1: this is warning msg. params:{0} {1}", 1, "test");
        }
    }

    public class Demo3 {
        private static readonly ILogger Log = MLog.GetLogger(typeof(Demo3));

        public static void TestLog() {
            Log.Debug("Demo3: this is debug msg. params:{0} {1}", 1, "test");
            Log.Info("Demo3: this is info msg. params:{0} {1}", 1, "test");
            Log.Error("Demo3: this is error msg. params:{0} {1}", 1, "test");
            Log.Warning("Demo3: this is warning msg. params:{0} {1}", 1, "test");
        }
    }
}

namespace Mlog.Test {
    public class Demo2 {
        private static readonly ILogger Log = MLog.MLog.GetLogger("MLog.Test.Demo2");

        public static void TestLog() {
            Log.Debug("Demo2: this is debug msg. params:{0} {1}", 1, "test");
            Log.Info("Demo2: this is info msg. params:{0} {1}", 1, "test");
            Log.Error("Demo2: this is error msg. params:{0} {1}", 1, "test");
            Log.Warning("Demo2: this is warning msg. params:{0} {1}", 1, "test");
        }
    }
}